const state = {
  title: '',
  left: true,
  right: undefined
}

const mutations = {
  SET_Title: (state, title) => {
    state.title = title
  },

  SET_Right: (state, right) => {
    state.right = right
  },

  SET: (state, palyload) => {
    const { title, left = true, right, help } = palyload
    console.log(' header, ', palyload)

    state.title = title
    state.left = left
    state.right = right
    state.help = help
  }
}

const actions = {
  setTitle({ commit, state, dispatch }, palyload) {
    // console.log('header, set,', palyload)
    commit('SET_Title', palyload)
    return new Promise(resolve => {
      resolve()
    })
  },

  setRight({ commit, state, dispatch }, palyload) {
    // console.log('header, set,', palyload)
    commit('SET_Right', palyload)
    return new Promise(resolve => {
      resolve()
    })
  },

  set({ commit, state, dispatch }, palyload) {
    // console.log('header, set,', palyload)
    commit('SET', palyload)
    return new Promise(resolve => {
      resolve()
    })
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
